﻿using System;
using System.Linq;
using System.Runtime.InteropServices;
using AfterTheDeadline;

namespace AfterTheDeadlineNet2Adapter
{
    [ComVisible(true)]
    [Guid("36C0ACF1-4475-4A36-B31C-F60F762A0B5C")]
    public class ErrorAdapter : IErrorAdapter
    {
        private Error _error;

        public ErrorAdapter(Error error)
        {
            _error = error;
        }

        #region IErrorAdapter Members

        public string Description
        {
            get { return _error.Description; }
        }

        public string Precontext
        {
            get { return _error.Precontext; }
        }

        public string String
        {
            get { return _error.String; }
        }

        public string[] Suggestions
        {
            get 
            {
                return _error.Suggestions != null ? _error.Suggestions.ToArray() : new string[] { };
            }
        }

        public string Type
        {
            get { return _error.Type; }
        }

        public string Url
        {
            get { return _error.Url; }
        }

        #endregion
    }
}
